package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface SetmealMapper {
    void add(Setmeal setmeal);

    void addSetmealCheckgroup(Integer id, List<Integer> list);

    void edit(Setmeal setmeal);

    @Delete("delete from t_setmeal_checkgroup where setmeal_id = #{id}")
    void deleteCheckgroupBySetmealId(Integer id);

    @Select("select * from t_setmeal where id = #{id}")
    Setmeal findById(Integer id);

    Page<CheckItem> findPage(String queryString);

    @Select("select * from t_setmeal")
    List<Setmeal> getSetmeal();

    /**
     * 根据id获取套餐名称
     * @param setmealId
     * @return
     */
    @Select("select name from t_setmeal where id = #{setmealId}")
    List<String> getNameById(Integer setmealId);


}
